<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}首页{% endblock %}</title>
    <link rel="icon" href="/static/images/userimg/default.png">

    <link crossorigin="anonymous" href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css"
          integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" rel="stylesheet"/>
    {#    <link rel="stylesheet" type="text/css" href="/static/css/denglong.css">#}
    <style>

        .card-img-top {
            width: 100%;
            height: 240px;
            object-fit: cover;
            transition: transform .2s; /* 动画效果 */
        }

        .card-img-top:hover {
            transform: scale(1.1); /* 鼠标悬停时放大 */
        }

        img.rounded-circle1 {
            width: 150px;
            height: 150px;
            border-radius: 50%;
        }

        .navbar a {
            color: #333;
        }

        .dropdown-item {
            color: #333;
        }

        .dropdown-item:hover {
            background-color: #f8f9fa;
        }

        .dropdown-menu {
            font-size: 16px;
        }

        img.rounded-circle {
            width: 40px;
            height: 40px;
        }

        /* 改变导航栏链接的大小 */
        {#.navbar-nav .nav-link {#}
        {#    font-size: 1.5rem;  /* 调整为适合你的大小 */#}
        {#    padding: .5rem 1rem;  /* 调整为适合你的大小 */}#}
        {##}
        {#/* 改变下拉菜单的大小 */#}
        {#.dropdown-menu {#}
        {#    font-size: 1.5rem;  /* 调整为适合你的大小 */}#}
        {##}
        {#/* 改变下拉菜单项的大小 */#}
        {#.dropdown-item {#}
        {#    padding: .5rem 1rem;  /* 调整为适合你的大小 */}#}
    </style>
    {% block head_extra %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container-fluid">
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <h1><a class="navbar-brand" href="#">跳蚤市场</a></h1>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <a aria-current="page" class="nav-link active" href="/">主页</a>
                <li class="nav-item">
                    <a class="nav-link" href="/shopping">商场</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#" onclick="return checkLoginStatus() ,luntan()">论坛</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/chat" onclick="return checkLoginStatus(), chat()">联系卖家</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/" onclick="return checkLoginStatus()">校园热点</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/upload">发布商品</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/myshell" onclick="return checkLoginStatus()">我的出售</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/mycollection" onclick="return checkLoginStatus()">我的收藏</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/mycart" onclick="return checkLoginStatus()">我的购物车</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/mybooking" onclick="return checkLoginStatus()">收货管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/shipment" onclick="return checkLoginStatus()">发货管理</a>
                </li>
            </ul>
            <ul class="navbar-nav">
                <li class="nav-item dropdown">
                    <a aria-expanded="false" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#"
                       id="navbarDropdownMenuLink" role="button">
                        <img alt="Profile" class="rounded-circle" src="/static/images/default.png"
                             onclick="return checkLoginStatus()"/> </a>
                    <ul aria-labelledby="navbarDropdownMenuLink" class="dropdown-menu">
                        <li>
                            <a class="dropdown-item" onclick="return checkLoginStatus(), mine() " href="#">
                                <b>个人资料</b>
                            </a>
                        </li>
                        <li>
                            <a class="dropdown-item" href="/more" onclick="return checkLoginStatus()">更多</a>
                        </li>
                        <li>
                            <a class="dropdown-item" href="#" onclick="logout()">
                                登出
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>


{#灯笼#}
<!-- 灯笼代码 -->
{#<meta charset="utf-8">#}
{#<div class="deng-box2">#}
{#    <div class="deng">#}
{#        <div class="xian">#}
{#        </div>#}
{#        <div class="deng-a">#}
{#            <div class="deng-b">#}
{#                <div class="deng-t">一</div>#}
{#            </div>#}
{#        </div>#}
{#        <div class="shui shui-a">#}
{#            <div class="shui-c">#}
{#            </div>#}
{#            <div class="shui-b"></div>#}
{#        </div>#}
{#    </div>#}
{#</div>#}
{#<div class="deng-box3">#}
{#    <div class="deng">#}
{#        <div class="xian">#}
{#        </div>#}
{#        <div class="deng-a">#}
{#            <div class="deng-b">#}
{#                <div class="deng-t">五</div>#}
{#            </div>#}
{#        </div>#}
{#        <div class="shui shui-a">#}
{#            <div class="shui-c"></div>#}
{#            <div class="shui-b">#}
{#            </div>#}
{#        </div>#}
{#    </div>#}
{#</div>#}
{#<div class="deng-box1">#}
{#    <div class="deng">#}
{#        <div class="xian">#}
{#        </div>#}
{#        <div class="deng-a">#}
{#            <div class="deng-b">#}
{#                <div class="deng-t">乐</div>#}
{#            </div>#}
{#        </div>#}
{#        <div class="shui shui-a">#}
{#            <div class="shui-c"></div>#}
{#            <div class="shui-b"></div>#}
{#        </div>#}
{#    </div>#}
{#</div>#}
{#<div class="deng-box">#}
{#    <div class="deng">#}
{#        <div class="xian">#}
{#        </div>#}
{#        <div class="deng-a">#}
{#            <div class="deng-b">#}
{#                <div class="deng-t">快</div>#}
{#            </div>#}
{#        </div>#}
{#        <div class="shui shui-a">#}
{#            <div class="shui-c">#}
{#            </div>#}
{#            <div class="shui-b"></div>#}
{#        </div>#}
{#    </div>#}
{#</div>#}
{##}

{% block content %}{% endblock %}
<script>
    function logout() {
        // 清除localStorage
        localStorage.clear();

        // 清除sessionStorage
        sessionStorage.clear();
        document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
        document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
        // 重定向到登出页面或主页
        window.location.href = "/";
    }

    function checkLoginStatus() {
        var username = localStorage.getItem('username');
        var token = localStorage.getItem('token');

        if (!username || !token) {
            alert("请先登录！")
            window.location.href = "/login";
            return false;
        }

        return true;
    }

    function luntan() {
        alert("论坛功能暂未开放！请移步到联系卖家——跳蚤市场公共频道")
    }

    function mine() {
        alert("即将开启！")
    }
    function chat() {
        alert("登录账号密码为你的邮箱与密码，如果消息列表加载不出来（PC浏览器请屏幕中央右键刷新框架）")
    }
</script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/js/bootstrap.bundle.min.js"></script>
{% block scripts %}{% endblock %}
</body>
</html>